﻿<?php
require_once("__construct.php");
class dbc {
	
	private static $dbc;
	private $host;
	private $user;
	private $pass;
	private $name;
	
	public function __construct(){
		
		$this->host = DB_HOST_win; // om mac använd DB_HOST_mac // för skarpt läge använd DB_HOST_on
		$this->user = DB_USER_win;
		$this->pass = DB_PASS_win;
		$this->name = DB_NAME_local_win;
		self::$dbc = new MySQLi($this->host, $this->user, $this->pass, $this->name);
		self::$dbc->set_charset("UTF-8");
		(!self::$dbc)? die('Could not connect to database' . mysqli_error()) : true;
		
		/**** if mac / inte testat men borde fungera i mac miljö *****/
		#self::$dbc = mysql_connect($this->host, $this->user, $this->pass);
		#self::$dbc->select_db($this->name);
		#self::$dbc->set_charset("UTF-8");
		#(!self::$dbc)? die('Could not connect: ' . mysql_error()) : true;
		#
		/****************** end if mac ***************/
		
	}
	
	public function query($var){
		return self::$dbc->query($var);
	}
	
	public function dbConnect() {
		return self::$dbc;
	}
	
}
?>